package drone.basis.dictionary ;

public enum CommandDict
{

	keep_alive ( ( byte ) 0x00 ) ,
	set_1bit ( ( byte ) 0x0f ) ,
	clear_1bit ( ( byte ) 0xf0 ) ,
	set_2B_BB ( ( byte ) 0xbb ) ,
	set_2B_CC ( ( byte ) 0xcc ) ,
	set_2B_DD ( ( byte ) 0xdd ) ,
	set_2B_EE ( ( byte ) 0xee ) ,
	get_var ( ( byte ) 0x55 ) ,
	read_32 ( ( byte ) 0xa1 ) ,
	write_32 ( ( byte ) 0xa2 ) ,
	read_16 ( ( byte ) 0xa3 ) ,
	write_16 ( ( byte ) 0xa4 ) ,
	read_bit ( ( byte ) 0xa5 ) ,
	write_bit ( ( byte ) 0xa6 ) ,
	;

	private byte code ;

	private CommandDict (
			byte code
	)
	{
		this.code = code ;

	}

	public byte getCode ( )
	{
		return code ;
	}

	public void setCode (
			byte code
	)
	{
		this.code = code ;
	}

	public static Boolean exist (
			String command
	)
	{
		for ( CommandDict item : CommandDict.values ( ) )
		{
			if ( item.name ( ).equalsIgnoreCase ( command ) )
			{
				return true ;
			}
		}

		return false ;
	}

	public static Boolean contain (
			byte value
	)
	{
		for ( CommandDict item : CommandDict.values ( ) )
		{
			if ( item.getCode ( ) == value )
			{
				return true ;
			}
		}

		return false ;
	}

}
